<template>
  <div class="list">
    <song-list-item
      v-for="item in resultList"
      :key="item.id"
      :imgUrl="item.coverImgUrl"
      :playCount="item.playCount"
      :listID="item.id"
      :label="item.name"
      :author="item.creator.nickname"
    ></song-list-item>
  </div>
</template>
  
<script>
import SongListItem from "@/components/SongListItem";
import { searchAPI } from "@/api";
export default {
  name: "SheetRes",
  components: { SongListItem },
  data() {
    return {
      resultList: [],
    };
  },
  methods: {
    async getResult() {
      const res = await searchAPI({
        keywords: this.keywords,
        type: 1000,
        limit: 40,
      });
      this.resultList = res.data.result.playlists;
    },
  },
  computed: {
    keywords() {
      return this.$store.state.search.searchWord;
    },
  },
  created() {
    this.getResult();
  },
};
</script>

<style>
.list {
  width: 95%;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}
</style>